package com.gaozhaoyang.base;
import com.gaozhaoyang.entity.Account;
import org.junit.Test;

import java.util.List;
public class AccountService1 {
    AccountDao1 dao1 =new AccountDao1();
    @Test
    public void findAccount() {
        String sql = "select * from account  where name =? and money =?";

        Account account = dao1.getEntity(sql, Account.class, "admin", 3200);

        System.out.println(account);
    }
    @Test
    public void findAll() {
        String sql = "select * from account where money>?";
        List<Account> accountList = dao1.getListEntity(sql, Account.class,3200);
        System.out.println(accountList);
    }
    @Test
    public void addAccount() {
        String sql = "insert into account values(?,?,?)";
        Account a = new Account();
        a.setId(7);
        a.setMoney(10000);
        a.setName("普京");
        System.out.println(dao1.update(sql, a.getId(), a.getName(), a.getMoney()) > 0 ? "添加成功" : "添加失败");
    }
}
